package com.imc.platform.demo.controller;

import com.imc.core.annotation.Logs;
import com.imc.platform.demo.httpservice.baidu.BaikeService;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by tanweiping on 2018/7/23.123
 */
@Controller
public class IndexController {

    @Autowired
    BaikeService baikeService;

    @GetMapping("/test/index")
    public String index(){
        val data = baikeService.baikeLemmaCardApi(
                baikeService.beanToMap(
                        BaikeService.BaikeLemmaCardApiParam.builder().bk_key("银魂").build()
                )
        );
        return "frame/index";
    }

    @Logs(enable = false)
    @GetMapping("/test/add")
    @ResponseBody
    public Object addUser() throws Exception {
        if (true){
            throw new Exception("ss");
        }
        return null;
    }

    @GetMapping("/test/delete")
    @ResponseBody
    public String delete() throws Exception{
        if (true){
            throw new Exception("ss");
        }
        return "delete";
    }


}
